home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 March
/
PCWorld_2008-03_cd.bin
/
v cisle
/
mediacoder
/
MediaCoder-0.6.1.4045.exe
/
htdocs
/
sys
/
sys.js
< prev
next >
Wrap
Text File
|
2007-12-22
|
2KB
|
61 lines
var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1;
var isMoz = document.implementation && document.implementation.createDocument;
function GetToken(str, token)
{
var idx = str.indexOf(token + '=');
if (idx <= 0) return null;
var argstr = str.substring(idx + token.length + 1);
idx = argstr.indexOf('&');
return idx >=0 ? argstr.substring(0, idx) : argstr;
}
function loadXML(xmlFile)
{
if (isIE) {
var xml = new ActiveXObject('Microsoft.XMLDOM');
xml.async = false;
if (!xml.load(xmlFile)) {
alert("Unable to load "+xmlFile);
return null;
}
return xml;
} else {
var $xml = new XMLHttpRequest;
$xml.open('GET', xmlFile, false);
$xml.overrideMimeType('text/xml');
$xml.send(null);
var xml = $xml.responseXML;
if (!xml) {
alert("Unable to load "+xmlFile);
return null;
}
return xml;
}
}
function transformXML(xmlDoc, xslDoc, element)
{
if (isIE) {
var e = document.getElementById(element);
if (e) e.innerHTML = xmlDoc.transformNode(xslDoc);
} else {
var XSLT = new XSLTProcessor;
XSLT.importStylesheet(xslDoc);
var e = document.getElementById(element);
e.innerHTML = "";
if (e) e.appendChild(XSLT.transformToFragment(xmlDoc, document));
}
}
function init()
{
window.innerWidth = 700;
window.innerHeight = 300;
var sysinfo = loadXML("/mc/sysinfo.xml");
var appinfo = loadXML("/mc/appinfo.xml");
transformXML(sysinfo, loadXML("summary.xsl"), "summary");
transformXML(appinfo, loadXML("appinfo.xsl"), "appinfo");
transformXML(sysinfo, loadXML("sysinfo.xsl"), "hardware");
}